// component/camera/camera.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        src: {
            type: String,
            value: ''
        },
        show_cam:{
            type:Boolean,
            value:false
        }
    },

    /**
     * 组件的初始数据
     */
    data: {

    },

    /**
     * 组件的方法列表
     */
    methods: {
        
        takePhoto() {
            console.log(1111)
            let that=this;
            const ctx = wx.createCameraContext()
            // const listener = ctx.onCameraFrame((frame) => {
            //     console.log(frame)
            // })
            ctx.takePhoto({
                quality: 'high',
                success: (res) => {
                    console.log(res)
                    let files=res.tempImagePath;
                    that.triggerEvent('cameraSuccess',files)
                    // listener.stop({
                    //     success: (res) => {
                    //         console.log(res)
                    //         that.triggerEvent('cameraSuccess',files)
                    //     },
                    //     fail: (err) => {
                    //         console.log(err)
                    //     }
                    // })
                },
                fail: (err) => {
                    console.log(err)
                }
            })
        }
    }
})